from django.db import models

# Create your models here.
class Types(models.Model):
    firsts=models.CharField('一级分类', max_length=100)
    seconds=models.CharField('二级分类', max_length=100)
    class Meta:
        verbose_name='商品类型'
        verbose_name_plural='商品类型'

class CommodityInfos(models.Model):
    id=models.AutoField('商品ID',primary_key=True)
    name=models.CharField('商品名称',max_length=100)
    color=models.CharField('商品颜色',max_length=100,null=True)
    types=models.CharField('商品类型',max_length=100)
    price=models.FloatField("商品价格",max_length=100)
    discount=models.FloatField("折后价格")
    stock=models.IntegerField('折后价格')
    sold=models.IntegerField('存货数量')
    likes=models.IntegerField('收藏数量')
    create=models.DateTimeField('上架日期',auto_now=True)
    img=models.FileField("商品主图",upload_to=r'imgs')
    details=models.FileField("商品介绍",upload_to=r'details')
    class Meta:
        verbose_name='商品信息'
        verbose_name_plural='商品信息'